
const loginModule = {
    namespaced: true,
    state: {
        username: "old name",
        password: ""
    },
    mutations: {
        submit(state,n="123") {
            state.username = n;
        },
        async_submit(state,n="2222") {
            state.username = n;
        }
    },
    actions: {
        submit({ commit }) {
            commit('submit')
        },
        async_submit({ commit }) {
            // eslint-disable-next-line no-unused-vars
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    commit('async_submit')
                    resolve()
                }, 1000)
            })
        },
        aaa_submit({ commit },data) {
            // eslint-disable-next-line no-unused-vars
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    commit('async_submit',data)
                    resolve()
                }, 1000)
            })
        }
    }
}

export default loginModule;